
package com.hazelcast.function;

import com.hazelcast.internal.util.ExceptionUtil;

/**
 * A {@link Runnable} that declares checked exception.
 *
 * @since 6.0
 */
@FunctionalInterface
public interface ThrowingRunnable extends Runnable {

    /**
     * Runs given action.
     *
     * @see Runnable#run
     */
    void runEx() throws Exception;

    @Override
    default void run() {
        try {
            runEx();
        } catch (Exception e) {
            throw ExceptionUtil.sneakyThrow(e);
        }
    }
}
